// 闭包作为方法的参数

// 无参数的闭包
def test1(Closure closure) {
    println "test1 start......"
    closure(); // 调用闭包
    println "test1 end....."
}

test1 { println "hahahahah............" }


// 有参数的闭包
def test2(Closure closure) {
    int a = 100;
    int b = 200;
    println "test1 start ...."
    closure(a,b); // 调用闭包
    println "test1 end....."
}

test2 {x,y -> {
    println("x:"+x)
    println("y:"+y)
}}